home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / pcl4p40.zip / TVTERM.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-10  |  2KB  |  68 lines

  1. program TVterm;
  2.  
  3. (*********************************************)
  4. (*                                           *)
  5. (*          TVTERM.PAS      July 1993        *)
  6. (*                                           *)
  7. (*  TVTERM is provided as a simple terminal  *)
  8. (*  program which is provided as an example  *)
  9. (*  of how to use PCL4P with Turbo Vision.   *)
  10. (*                                           *)
  11. (*  This program is donated to the Public    *)
  12. (*  Domain by MarshallSoft Computing, Inc.   *)
  13. (*                                           *)
  14. (*********************************************)
  15.  
  16. uses Objects, Drivers, App, PCL4P;
  17.  
  18. type
  19.   PTVtermApp = ^TTVtermApp;
  20.   TTVtermApp = object(TApplication)
  21.     procedure HandleEvent(var Event: TEvent); virtual;
  22.     procedure Idle; virtual;
  23.   end;
  24.  
  25. (* global comm variables *)
  26.  
  27. var
  28.    Buffer  : array[0..1024] of char;
  29.    RetCode : Integer;
  30.  
  31. procedure TTVtermApp.Idle;
  32. begin
  33.   (* copy any received serial input to the screen *)
  34.   RetCode := SioGetc(COM1,0);
  35.   if RetCode>-1 then write( char(RetCode) )
  36. end;
  37.  
  38. { TTVtermApp }
  39.  
  40. procedure TTVtermApp.HandleEvent(var Event: TEvent);
  41. begin
  42.   TApplication.HandleEvent(Event);
  43.   (* process the event *)
  44.   case Event.What of
  45.       evKeyDown:
  46.         begin
  47.           (* transmit any keyboard input *)
  48.           RetCode := SioPutc(COM1,Event.CharCode);
  49.         end;
  50.   else ClearEvent(Event);
  51.   end
  52. end;
  53.  
  54. var
  55.   TVtermWorld: TTVtermApp;
  56.  
  57. begin
  58.   (* initialize the comm *)
  59.   RetCode := SioRxBuf(COM1,Ofs(Buffer),Seg(Buffer),Size1024);
  60.   RetCode := SioReset(COM1,Baud2400);
  61.   (* run Turbo Vision *)
  62.   TVtermWorld.Init;
  63.   TVtermWorld.Run;
  64.   TVtermWorld.Done;
  65.   (* shut down the comm *)
  66.   RetCode := SioDone(COM1);
  67. end.
  68.